/* ---------------------------------------------------------------------------
** This software is in the public domain, furnished "as is", without technical
** support, and with no warranty, express or implied, as to its usefulness for
** any purpose.
**
** TorrentFile.h
** TorrentFile class parse the .torrent file as ourself format.
** The class can alse generate .torrent file of both single file and dir.
**
** Author: wuwei0509@gmail.com
** -------------------------------------------------------------------------*/

#ifndef _TORRENTFILE_H
#define _TORRENTFILE_H

//includes
#include <vector>
#include <string>
#include <map>
#include "BencodingHandler.h"
using namespace std;
//macros

//class
class TorrentFile {
	//methods
public:
	TorrentFile();
	~TorrentFile();

	void ParseSeedFile(char * fullPath);
	void GenerateSeedFileFromSingleFile(char * file);
	void GenerateSeedFileFromDirectory(char * dir);
	
	void PrintInfo();
private:
	BencodingData BuildSeedFileDict(char * seedContent, __int64& startPos);
	//members
public:	
private:
	vector<string> trackerList;
	string createdBy;
	__int64 creationDate;
	string encoding;

	size_t pieceLength;
	vector<string> pieces;
	string name;
	__int64 fileLength;
	vector<map<__int64, string> > files;
};


#endif